//
//  TopicObjModel.m
//  Topic1
//
//  Created by 孙添凤 on 16/12/6.
//  Copyright © 2016年 孙添凤. All rights reserved.
//

#import "TopicObjModel.h"

@implementation TopicObjModel

+(JSONKeyMapper*)keyMapper {
    
    /* 注意JuhuiModel里面需要映射2种类型
     1. 驼峰Camel命名规范
     2. 把author.header_img和author_username要映射到JuhuiModel直接字段里面 */
    JSONKeyMapper *mapper = [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
    // 取得影射的blocks对象
    JSONModelKeyMapBlock modelBlock = mapper.modelToJSONKeyBlock;
    
    // 根据上述的重新创建映射条件
    JSONKeyMapper *newMapper = [[JSONKeyMapper alloc] initWithJSONToModelBlock:nil modelToJSONBlock:^NSString *(NSString *keyName) {
        // 告诉我们影射规律
        if ([keyName isEqualToString:@"T_17796_0"]) {
            return @"T_17796_0";
        } else if ([keyName isEqualToString:@"AFM_1"]) {
            return @"AFM_1";
        } else if ([keyName isEqualToString:@"AFM_11"]) {
            return @"AFM_11";
        } else if ([keyName isEqualToString:@"AFM_12"]) {
            return @"AFM_12";
        } else if ([keyName isEqualToString:@"AFM_4"]) {
            return @"AFM_4";
        }else if ([keyName isEqualToString:@"AFM_5"]) {
            return @"AFM_5";
        }else if ([keyName isEqualToString:@"AFM_9"]) {
            return @"AFM_9";
        }else if ([keyName isEqualToString:@"AFM_8"]) {
            return @"AFM_8";
        }else if ([keyName isEqualToString:@"AFM_6"]) {
            return @"AFM_6";
        }else if ([keyName isEqualToString:@"AFM_7"]) {
            return @"AFM_7";
        }else if ([keyName isEqualToString:@"CREATER_ATM_7_0_432"]) {
            return @"CREATER_ATM_7_0_432";
        }else if ([keyName isEqualToString:@"DIC_AFM_4"]) {
            return @"DIC_AFM_4";
        }else if ([keyName isEqualToString:@"DIC_AFM_5"]) {
            return @"DIC_AFM_5";
        }else if ([keyName isEqualToString:@"LMF_ID"]) {
            return @"LMF_ID";
        }else if ([keyName isEqualToString:@"T_17798_0"]) {
            return @"T_17798_0";
        }else if ([keyName isEqualToString:@"STU_ID_ATM_2_1_448"]) {
            return @"STU_ID_ATM_2_1_448";
        }else if ([keyName isEqualToString:@"ismySelf"]) {
            return @"ismySelf";
        }else if ([keyName isEqualToString:@"USER_ID_ATM_3_1_432"]) {
            return @"USER_ID_ATM_3_1_432";
        }else if ([keyName isEqualToString:@"AFM_15"]) {
            return @"AFM_15";
        }else if ([keyName isEqualToString:@"AFM_14"]) {
            return @"AFM_14";
        }else if ([keyName isEqualToString:@"AFM_16"]) {
            return @"AFM_16";
        }else if ([keyName isEqualToString:@"CHANNELNAME"]) {
            return @"CHANNELNAME";
        }else if ([keyName isEqualToString:@"CHANNELCONTACTS"]) {
            return @"CHANNELCONTACTS";
        }else if ([keyName isEqualToString:@"DIC_CHANNELTYPE"]) {
            return @"DIC_CHANNELTYPE";
        }else if ([keyName isEqualToString:@"CHANNELLATESTTIME"]) {
            return @"CHANNELLATESTTIME";
        }else if ([keyName isEqualToString:@"CHANNELLATESTMESSAGE"]) {
            return @"CHANNELLATESTMESSAGE";
        }else if ([keyName isEqualToString:@"CHANNELID"]) {
            return @"CHANNELID";
        }else if ([keyName isEqualToString:@"CHANNELIMAGE"]) {
            return @"CHANNELIMAGE";
        }else if ([keyName isEqualToString:@"MESSCONTENT"]) {
            return @"MESSCONTENT";
        }else if ([keyName isEqualToString:@"PASSTHROUGHOBJECT"]) {
            return @"PASSTHROUGHOBJECT";
        }else if ([keyName isEqualToString:@"DIC_MESSTYPE"]) {
            return @"DIC_MESSTYPE";
        }else if ([keyName isEqualToString:@"DIC_SENDERTYPE"]) {
            return @"DIC_SENDERTYPE";
        }else if ([keyName isEqualToString:@"MESSFILE"]) {
            return @"MESSFILE";
        }else if ([keyName isEqualToString:@"DIC_FILETYPE"]) {
            return @"DIC_FILETYPE";
        }else if ([keyName isEqualToString:@"SENDERNAME"]) {
            return @"SENDERNAME";
        }else if ([keyName isEqualToString:@"STUNAME"]) {
            return @"STUNAME";
        }else if ([keyName isEqualToString:@"CUSTOMNAME"]) {
            return @"CUSTOMNAME";
        }else if ([keyName isEqualToString:@"DEFAULTNAME"]) {
            return @"DEFAULTNAME";
        }else if ([keyName isEqualToString:@"userid"]) {
            return @"USERID";
        }else if ([keyName isEqualToString:@"SEND_ID"]) {
            return @"SEND_ID";
        }else if ([keyName isEqualToString:@"SEND_NAME"]) {
            return @"SEND_NAME";
        }
        return modelBlock(keyName);
    }];
    return newMapper;
    
    
    //return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}


+(BOOL)propertyIsOptional:(NSString*)propertyName {
    return  YES;
}

//
//- (id)initWithDictionary:(NSDictionary *)dict
//{
//    self = [super init];
//    if (self) {
//        [self setValuesForKeysWithDictionary:dict];
//    }
//    return self;
//}
//
//+ (id)HWInfoWithDictionary:(NSDictionary *)dict
//{
//    return [[self alloc] initWithDictionary:dict];
//}
@end
